unit frm_MeterPaysInd;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, shbl_Card, ActnList, ComCtrls, ToolWin, StdCtrls, Buttons,
  ExtCtrls, GridsEh, DBGridEh, DBCtrls, DB, FIBDataSet, pFIBDataSet,
  PropFilerEh, PropStorageEh;

type
  TfrmMeterPaysInd = class(TshblCard)
    Panel2: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    DBText1: TDBText;
    DBText2: TDBText;
    DBGridEh1: TDBGridEh;
    dsMeterPaysInd: TpFIBDataSet;
    dscMeterPaysInd: TDataSource;
    dsMeterPaysIndRDOCYEAR: TFIBIntegerField;
    dsMeterPaysIndRDOCMONTH: TFIBIntegerField;
    dsMeterPaysIndRSUMMA: TFIBBCDField;
    dsMeterPaysIndRMAXIND: TFIBBCDField;
    dsMeterHeader: TpFIBDataSet;
    dscMeterHeader: TDataSource;
    dsMeterHeaderID: TFIBIntegerField;
    dsMeterHeaderMETER_NUM: TFIBStringField;
    dsMeterHeaderMETER_NAME: TFIBStringField;
    procedure aCancelExecute(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    PDogovor_id:integer;
    PMeter_id:integer;
  end;

var
  frmMeterPaysInd: TfrmMeterPaysInd;

implementation

uses uDM, frm_ChargeMeter;

{$R *.dfm}

procedure TfrmMeterPaysInd.aCancelExecute(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TfrmMeterPaysInd.FormCreate(Sender: TObject);
begin
  PMeter_id := 0;
end;

procedure TfrmMeterPaysInd.FormShow(Sender: TObject);
begin
  if PMeter_id = 0 then Close;
  dsMeterHeader.Close;
  dsMeterHeader.ParamByName('pmeter_id').Value := PMeter_id;

  if not MAINDM.pMainDatabase.Connected then exit;

  dsMeterHeader.Open;

  dsMeterPaysInd.Close;
  dsMeterPaysInd.ParamByName('pdogovor_id').Value := PDogovor_id;
  dsMeterPaysInd.ParamByName('pmeter_id').Value := PMeter_id;
  dsMeterPaysInd.Open;
end;


end.
